package ru.usu.gv.uicomponents.viewitems.vertex;

import com.sun.j3d.utils.geometry.Cone;

import ru.usu.gv.styles.StyleFacade;
import ru.usu.gv.uicomponents.UIElementBase;
import ru.usu.gv.uicomponents.viewitems.ViewItemBase;
import ru.usu.gv.utils.geometry.Polyline;

import javax.media.j3d.Appearance;
import javax.media.j3d.TransformGroup;
import javax.vecmath.Color3f;

import java.awt.Color;

/**
 @author Sergey Pupyrev 
 25.03.2007
 */

public class ConeView extends ViewItemBase implements IVertexViewItem
{
	private Cone cone;

	public ConeView(Appearance appearance, TransformGroup tg)
	{
		super(tg, appearance, appearance.getMaterial());

		float normalSize = (float) StyleFacade.getVertexSize();
		float radius = normalSize;
		float height = (float) (2.0 * normalSize);
		cone = new Cone(radius, height, appearance);
		tg.addChild(cone);
	}

	public void makePickable(UIElementBase ge)
	{
		ge.makePickable(cone.getShape(Cone.BODY));
		ge.makePickable(cone.getShape(Cone.CAP));
	}

	@Override
	public void setColor(Color color)
	{
		super.setColor(color);
		getMaterial().setDiffuseColor(new Color3f(color));
	}

	public Polyline getBoundingPolygon()
	{
		// TODO Auto-generated method stub
		return null;
	}

}
